<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="工序占比" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<script language="javascript">
	function doSave(){
		document.getElementById("buttonDiv").style.display="none";
		document.getElementById("waitDiv").style.display="";
		frm.submit();
	}
	function doCancel(){
		parent.ClosePop();
	}
	function showMe(){
		showFormErrorMsg();
	
		<c:if test="${fn:length(list)>0}">
		document.getElementById("percent_${list[0].workProcess.id}").focus();
		</c:if>
	}
	function checkInput(nextId){
		if(window.event.keyCode==13){
			if(document.getElementById("percent_"+nextId)!=null){
				document.getElementById("percent_"+nextId).focus();
			}else{
				doSave();
			}
		}
	}
</script>
</head>
<body oncontextmenu="return false" onLoad="showMe();" class="sheet modal-dialog" style=" padding-top:15px;">
<div class="sheet-main" id="bodyDiv" style="width:380px;">
	<form name="frm" method="post" action="SetWorkProcessPercent.ihtm">
	  <div class="sheet-list" style="width:100%">
	    <div class="modal-main search-business">
	    	<div style="width:100%;">
				<c:set var="pageTopTitle" value="${workCenter.wcName}" />
				<%@ include file="../inc/PageTop.jsp"%> 
				<table border="0" cellspacing="1" cellpadding="1" align="center" class="table-0">
					<colgroup>
	        			<col width=25%></col>
	        			<col width=25%></col>
	        			<col width=25%></col>
	        			<col width=25%></col>
	    			</colgroup>
					<c:forEach var="item" items="${list}" varStatus="i">
					<c:if test="${fn:length(list)>i.index+1}"><c:set var="nextId" value="${list[i.index+1].workProcess.id}" /></c:if>
					<c:if test="${fn:length(list)<=i.index+1}"><c:set var="nextId" value="0" /></c:if>
					<tr>
				      	<th>工序名称：</th>
				      	<td>${item.workProcess.processName}</td>
				      	<th>工序占比：</th>
				      	<td>
				      		<input type="text" class="TextBox" maxlength="6" style="width:40px" id="percent_${item.workProcess.id}" name="percent_${item.workProcess.id}" value="${item.percentStr}" onKeyUp="checkInput(${nextId});">						
				     	</td>
					</tr>
					</c:forEach>
					<tr>
						<th colspan="4" class="give"><div align="center"><br>工序占比：该工序在工作中心所占的产值比例</div></th>
					</tr>
				</table>
			</div>
	  	</div>
	  </div>
		<div class="modal-buttom" id="buttonDiv">
			<input type="button" class="buttom-a" value="保 存" onClick="doSave();">
			<input type="button" class="buttom-a" value="取 消" onClick="doCancel();">
			<input type="hidden" id="wc_id" name="wc_id" value="${workCenter.id}">
		</div>
		<div class="modal-buttom" id="waitDiv" style="display:none">
			<span style="color:#ffffff">请稍候...</span>
		</div>
	</form>
</div>		
</body>
</html>